<template>
  <div>
    <!--    表格-->
    <el-table :data="truckTypeData.items">
      <el-table-column label="姓名" prop="name"/>
      <el-table-column label="准载重量(千克)" prop="allowableLoad"/>
      <el-table-column label="准载体积(方)" prop="allowableVolume"/>
      <el-table-column label="长(米)" prop="measureLong"/>
      <el-table-column label="宽(米)" prop="measureWidth"/>
      <el-table-column label="高(米)" prop="measureHigh"/>
      <el-table-column label="货物类型">
        <template slot-scope="scope">
          <el-select v-model="scope.row.goodsTypeIds" :multiple="true" placeholder="选择货物类型" disabled="disabled">
            <el-option
              v-for="item in orderTypeData"
              :key="item.id"
              :label="item.name"
              :value="item.id"
            >
            </el-option>
          </el-select>
        </template>
      </el-table-column>
    </el-table>

    <!--    分页-->
    <el-pagination
      @size-change="handleSizeChange"
      @current-change="handleCurrentChange"
      :current-page="Number(truckTypeData.page)"
      :page-sizes="[5, 10, 30, 50]"
      :page-size="Number(truckTypeData.pageSize)"
      layout="total, sizes, prev, pager, next, jumper"
      :total="Number(truckTypeData.counts)">
    </el-pagination>

  </div>
</template>

<script>
import truckType from '@/api/base/truckType/index'

export default {
  name: 'index',
  data() {
    return {
      truckTypeData: {},
      pageNum: 1,
      pageSize: 5,
      orderTypeData: []

    }
  }, methods: {
    handleSizeChange(val){
      this.pageSize=val;
      this.truckTypePage();
    },
    handleCurrentChange(val){
      this.pageNum=val;
      this.truckTypePage();
    },
    truckTypePage() {
      truckType.truckTypePage(this.pageNum, this.pageSize).then(data => {
        this.truckTypeData = data.data
      })
    },
    getOrderTypeAll() {
      truckType.getOrderTypeAll().then(data => {
        this.orderTypeData = data.data
      })
    }
  },
  mounted() {
    this.truckTypePage()
    this.getOrderTypeAll()
  }
}
</script>

<style scoped>

</style>
